_package("alz.mui");

_import("alz.mui.Component");

/**
 * 对话框组件
 */
_class("Dialog", Component, function(){
	this._init = function(){
		_super._init.call(this);
		this._app = null;  //所属应用
		this._cbid = 0;    //回调任务编号
	};
	this.create = function(parent, app, params){
		this.setParent(parent);
		this.setApp(app);
		this.setParams(params);
	};
	this.init = function(obj){
		_super.init.apply(this, arguments);
		this._self.tabIndex = 1;
	};
	this.reset = function(params){
		this.setParams(params);
	};
	this.dispose = function(){
		this._cbid = 0;
		this._app = null;
		_super.dispose.apply(this);
	};
	this.setApp = function(v){
		this._app = v;
	};
	this.setParams = function(v){
		this._params = v;
	};
	this.setReq = function(cbid){
		this._cbid = cbid;
	};
	this.focus = function(){
		this._self.focus();
	};
	this.show = function(){
		this.setVisible(true);
		try{
			this.focus();  //抢夺其他组件焦点
		}catch(ex){
		}
		if(this.onShow){
			this.onShow();
		}
	};
	this.hide = function(){
		this.setVisible(false);
	};
	/**
	 * 点击取消
	 */
	this.do_dlg_cancel = function(act, sender){
		/*
		//this.close();
		if(sender.tagName == "INPUT"){
			this.showModal(false);
		}
		*/
		var argv = [this, act];  //回调函数的第一个参数一定是对话框组件本身;
		runtime._task.execute(this._cbid, argv);  //执行回调函数
		/*
		if(this.onClose){  //执行回调函数
			this.onClose();
		}
		*/
	};
});